#include <iostream>
#include <vector>
#include "geometry.h"

int main()
{
   int n;
   std::cin >> n;
   std::vector<point> chain;
   for (int i = 0; i < n; i++)
   {
      double x, y;
      std::cin >> x >> y;
      chain.push_back(point(x, y));
   }
   double eps;
   std::cin >> eps;
   
   std::vector<int> ans = douglas_peucker(chain, eps, 1, n);
   
   std::cout << ans.size() << "\n";
   int ans_size = ans.size();
   for (int i = 0; i < ans_size; i++)
   {
      std::cout << ans[i] << " ";
   }
   return 0;
}